<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <YOUR NAME HERE>
 */
class Application_Model_Formation extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(100)
     *
     * @var int
     */
    protected $_IdFor;

    /**
     * Database var type varchar(100)
     *
     * @var string
     */
    protected $_ModeleFor;

    /**
     * Database var type varchar(100)
     *
     * @var string
     */
    protected $_LibelleFor;

    /**
     * Database var type int(2)
     *
     * @var int
     */
    protected $_NbrheurFor;

    /**
     * Database var type int(3)
     *
     * @var int
     */
    protected $_NbrjourFor;

    /**
     * Database var type varchar(1000)
     *
     * @var string
     */
    protected $_DescriptionFor;

    /**
     * Database var type varchar(8)
     *
     * @var string
     */
    protected $_EnseignantCinEnseig;



    /**
     * Dependent relation fk_parcours_has_formation_formation1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Ordre
     */
    protected $_Ordre;

    /**
     * Dependent relation fk_questionnaire_formation1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Questionnaire
     */
    protected $_Questionnaire;

    /**
     * Dependent relation fk_sessionformation_formation1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Sessionformation
     */
    protected $_Sessionformation;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'id_for'=>'IdFor',
            'modele_for'=>'ModeleFor',
            'libelle_for'=>'LibelleFor',
            'nbrheur_for'=>'NbrheurFor',
            'nbrjour_for'=>'NbrjourFor',
            'description_for'=>'DescriptionFor',
            'enseignant_cin_enseig'=>'EnseignantCinEnseig',
        ));

        $this->setParentList(array(
        ));

        $this->setDependentList(array(
            'FkParcoursHasFormationFormation1' => array(
                    'property' => 'Ordre',
                    'table_name' => 'Ordre',
                ),
            'FkQuestionnaireFormation1' => array(
                    'property' => 'Questionnaire',
                    'table_name' => 'Questionnaire',
                ),
            'FkSessionformationFormation1' => array(
                    'property' => 'Sessionformation',
                    'table_name' => 'Sessionformation',
                ),
        ));
    }

    /**
     * Sets column id_for
     *
     * @param int $data
     * @return Application_Model_Formation
     */
    public function setIdFor($data)
    {
        $this->_IdFor = $data;
        return $this;
    }

    /**
     * Gets column id_for
     *
     * @return int
     */
    public function getIdFor()
    {
        return $this->_IdFor;
    }

    /**
     * Sets column modele_for
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setModeleFor($data)
    {
        $this->_ModeleFor = $data;
        return $this;
    }

    /**
     * Gets column modele_for
     *
     * @return string
     */
    public function getModeleFor()
    {
        return $this->_ModeleFor;
    }

    /**
     * Sets column libelle_for
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setLibelleFor($data)
    {
        $this->_LibelleFor = $data;
        return $this;
    }

    /**
     * Gets column libelle_for
     *
     * @return string
     */
    public function getLibelleFor()
    {
        return $this->_LibelleFor;
    }

    /**
     * Sets column nbrheur_for
     *
     * @param int $data
     * @return Application_Model_Formation
     */
    public function setNbrheurFor($data)
    {
        $this->_NbrheurFor = $data;
        return $this;
    }

    /**
     * Gets column nbrheur_for
     *
     * @return int
     */
    public function getNbrheurFor()
    {
        return $this->_NbrheurFor;
    }

    /**
     * Sets column nbrjour_for
     *
     * @param int $data
     * @return Application_Model_Formation
     */
    public function setNbrjourFor($data)
    {
        $this->_NbrjourFor = $data;
        return $this;
    }

    /**
     * Gets column nbrjour_for
     *
     * @return int
     */
    public function getNbrjourFor()
    {
        return $this->_NbrjourFor;
    }

    /**
     * Sets column description_for
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setDescriptionFor($data)
    {
        $this->_DescriptionFor = $data;
        return $this;
    }

    /**
     * Gets column description_for
     *
     * @return string
     */
    public function getDescriptionFor()
    {
        return $this->_DescriptionFor;
    }

    /**
     * Sets column enseignant_cin_enseig
     *
     * @param string $data
     * @return Application_Model_Formation
     */
    public function setEnseignantCinEnseig($data)
    {
        $this->_EnseignantCinEnseig = $data;
        return $this;
    }

    /**
     * Gets column enseignant_cin_enseig
     *
     * @return string
     */
    public function getEnseignantCinEnseig()
    {
        return $this->_EnseignantCinEnseig;
    }

    /**
     * Sets dependent relations fk_parcours_has_formation_formation1
     *
     * @param array $data An array of Application_Model_Ordre
     * @return Application_Model_Formation
     */
    public function setOrdre(array $data)
    {
        $this->_Ordre = array();

        foreach ($data as $object) {
            $this->addOrdre($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_parcours_has_formation_formation1
     *
     * @param Application_Model_Ordre $data
     * @return Application_Model_Formation
     */
    public function addOrdre(Application_Model_Ordre $data)
    {
        $this->_Ordre[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_parcours_has_formation_formation1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Ordre
     */
    public function getOrdre($load = true)
    {
        if ($this->_Ordre === null && $load) {
            $this->getMapper()->loadRelated('FkParcoursHasFormationFormation1', $this);
        }

        return $this->_Ordre;
    }

    /**
     * Sets dependent relations fk_questionnaire_formation1
     *
     * @param array $data An array of Application_Model_Questionnaire
     * @return Application_Model_Formation
     */
    public function setQuestionnaire(array $data)
    {
        $this->_Questionnaire = array();

        foreach ($data as $object) {
            $this->addQuestionnaire($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_questionnaire_formation1
     *
     * @param Application_Model_Questionnaire $data
     * @return Application_Model_Formation
     */
    public function addQuestionnaire(Application_Model_Questionnaire $data)
    {
        $this->_Questionnaire[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_questionnaire_formation1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Questionnaire
     */
    public function getQuestionnaire($load = true)
    {
        if ($this->_Questionnaire === null && $load) {
            $this->getMapper()->loadRelated('FkQuestionnaireFormation1', $this);
        }

        return $this->_Questionnaire;
    }

    /**
     * Sets dependent relations fk_sessionformation_formation1
     *
     * @param array $data An array of Application_Model_Sessionformation
     * @return Application_Model_Formation
     */
    public function setSessionformation(array $data)
    {
        $this->_Sessionformation = array();

        foreach ($data as $object) {
            $this->addSessionformation($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_sessionformation_formation1
     *
     * @param Application_Model_Sessionformation $data
     * @return Application_Model_Formation
     */
    public function addSessionformation(Application_Model_Sessionformation $data)
    {
        $this->_Sessionformation[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_sessionformation_formation1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Sessionformation
     */
    public function getSessionformation($load = true)
    {
        if ($this->_Sessionformation === null && $load) {
            $this->getMapper()->loadRelated('FkSessionformationFormation1', $this);
        }

        return $this->_Sessionformation;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_Formation
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_Formation());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_Formation::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdFor() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('id_for = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdFor()));
    }
}
